import Vue from 'vue'

import VueRouter from 'vue-router'

Vue.use(VueRouter)

import routes from '@/router/routes'


// 重写push方法
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location,resolve,reject) {
  if(resolve || reject){
    return originalPush.call(this,location,resolve,reject)
  }else{
    return originalPush.call(this,location,()=>{},()=>{})
  }
}
// 重写replace方法
const originalReplace = VueRouter.prototype.replace
VueRouter.prototype.replace = function replace(location,resolve,reject) {
  if(resolve || reject){    
    return originalReplace.call(this,location,resolve,reject)
  }else{
    return originalReplace.call(this,location,()=>{},()=>{})
  }
}


export default new VueRouter({
  routes
})